import request from '@/utils/request'

// 查询新闻
export function listInfo(cid,infotitle,pageindex,pagesize,sh,tgid) {
    return request({
      url: 'system/info/find_by_categoryid_paging?categoryid='+ cid + '&infotitle=' + infotitle + '&pageindex=' + pageindex + '&pagesize=' + pagesize + '&shifoushenhe=' + sh + '&tougaorenid=' + tgid,
      method: 'post'
    })
}

// 查询已通过新闻
export function listpassInfo(cid,infotitle,pageindex,pagesize) {
    return request({
      url: 'system/info/find_passed_by_categoryid_paging?categoryid='+ cid + '&infotitle=' + infotitle + '&pageindex=' + pageindex + '&pagesize=' + pagesize,
      method: 'post'
    })
}

// 查询单条新闻
export function oneInfo(id) {
    return request({
      url: 'system/info/findone?infoid='+ id,
      method: 'post'
    })
}


// 添加新闻
export function addInfo(data) {
    return request({
        url: 'system/info/addcustom',
        method: 'post',
        data: data
    })
}

// 修改新闻
export function editInfo(data) {
    return request({
        url: 'system/info/modifycustom',
        method: 'post',
        data: data
    })
}

// 删除新闻
export function delInfo(infoid, catid) {
    return request({
        url: 'system/info/deletecustom?infoid='+ infoid +'&categoryid='+ catid,
        method: 'post'
    })
}

// 添加文件
export function uploadImg(head,data) {
  return request({
      url: '/common/upload',
      method: 'post',
      headers: head,
      data
  })
}

// 查询栏目-下级-左侧
export function leftCategorylist(id) {
    return request({
      url: 'system/category/findallxiajibyparentcategoryid?categoryid='+ id,
      method: 'post'
    })
}

// 查询接收人
export function getPeople() {
    return request({
      url: 'system/user/listShouzhang?pageNum=1&pageSize=200',
      method: 'get'
    })
}

// 添加留言
export function addGustbook(data) {
    return request({
      url: 'system/newguestbookAsk',
      method: 'post',
      data
    })
}

// 前端获取留言列表
export function getGustbooklist(pn,ps,rid,cot,ir) {
  return request({
    url: 'system/newguestbookAsk/listNews?pageNum='+ pn + '&pageSize=' + ps + '&receiverId='+ rid + '&content='+ cot + '&isReview=' + ir,
    method: 'get',
  })
}

// 回复留言
export function getReply(data) {
  return request({
    url: 'system/newguestbookReply',
    method: 'post',
    data
  })
}

// 删除回复
export function delReply(id) {
  return request({
    url: 'system/newguestbookReply/' + id,
    method: 'delete'
  })
}
// 审核留言
export function getExamine(data) {
  return request({
    url: 'system/newguestbookAsk',
    method: 'put',
    data
  })
}

// 查询问卷
export function getQuestuin(pn,ps,iv) {
  return request({
    url: 'system/tiku/list?pageNum=' + pn + '&pageSize=' + ps + '&isvalid=' + iv,
    method: 'get'
  })
}

// 新增问卷
export function addQuestuin(data) {
  return request({
    url: 'system/tiku',
    method: 'post',
    data
  })
}

// 修改问卷
export function editQuestuin(data) {
  return request({
    url: 'system/tiku',
    method: 'put',
    data
  })
}

// 查询单张问卷
export function getQuestuinone(id) {
  return request({
    url: 'system/tiku/' + id,
    method: 'get'
  })
}

// 题目类型
export function topicType() {
  return request({
    url: 'system/dict/data/list?pageNum=1&pageSize=10&dictType=wenjuan_timu_leixing',
    method: 'get'
  })
}

// 添加题目
export function addTopicone(data) {
  return request({
    url: 'system/timu',
    method: 'post',
    data
  })
}
// 获取一张问卷下面的题目
export function getQuesTopic(id,iv) {
  return request({
    url: 'system/tiku/selectOneWenjuan?tikuid=' + id + '&isvalid=' + iv,
    method: 'get',
  })
}

// 统计一张问卷各题的答题情况
export function getAnswerTopic(id) {
  return request({
    url: 'system/dajuan/selectWenJuanXuanZeTi?tikuid=' + id,
    method: 'post',
  })
}

// 查询单条题目
export function getTopicone(id) {
  return request({
    url: 'system/timu/' + id,
    method: 'get'
  })
}
// 修改题目
export function editTopicone(data) {
  return request({
    url: 'system/timu',
    method: 'put',
    data
  })
}

// 删除题目
export function delTopicone(id) {
  return request({
    url: 'system/timu/' + id,
    method: 'delete'
  })
}

// 增加题目选项
export function addTopicitem(data) {
  return request({
    url: 'system/xuanxiang',
    method: 'post',
    data
  })
}

// 查询单条题目选项
export function getTopicitemone(id) {
  return request({
    url: 'system/xuanxiang/' + id,
    method: 'get'
  })
}

// 修改题目选项
export function editTopicitem(data) {
  return request({
    url: 'system/xuanxiang',
    method: 'put',
    data
  })
}

// 删除题目选项
export function delTopicitem(id) {
  return request({
    url: 'system/xuanxiang/' + id,
    method: 'delete'
  })
}

// 门户提交问卷调查
export function submmitQuestion(data) {
  return request({
    url: 'system/dajuan/wenjuanrenDaTi',
    method: 'post',
    data
  })
}

// 统计下属部门投稿数量
export function statisticsNum() {
  return request({
    url: 'system/info/tongJiXinWen',
    method: 'post'
  })
}
